#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <QStandardPaths>
#include <QProcess>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QString location = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);

    QProcess p(0);

    QStringList args;
    args.append(location + "/test.txt");

    p.start("tar -zcvf *.tar.gz ./"+location,args); //command是要执行的命令,args是参数
    p.waitForFinished();//等待完成
}

MainWindow::~MainWindow()
{
    delete ui;
}
